package com.boyuan.huijiaoyu;

import com.boyuan.huijiaoyu.R;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

/**
 * @author liqingjun
 * 
 */
public class ScanResultActivity extends BaseActivity implements OnClickListener {

	private final static String TAG = "ScanResultActivity";

	private Button btnCancel;

	private TextView tv_result;

	private String result;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.scan_result_activity);

		init();
		prepareView();
		prepareData();
	}

	private void init() {
		Intent intent = getIntent();

		result = intent.getStringExtra("result");
	}

	private void prepareView() {
		btnCancel = (Button) findViewById(R.id.btn_back);
		btnCancel.setOnClickListener(this);

		tv_result = (TextView) findViewById(R.id.tv_result);
		tv_result.setOnClickListener(this);
	}

	private void prepareData() {

		showResult(result);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back:
			setResult(RESULT_CANCELED);
			finish();
			break;
		case R.id.tv_result:

			break;
		default:
			break;
		}
	}

	// 更新信息
	public void showResult(String result) {

		tv_result.setText(result);

	}


	@Override
	public void backClicked() {

		isBackAllowed = true;
		setResult(RESULT_CANCELED);
	}

}
